import Vuex from 'vuex'
import Vue from 'vue'
// import { selectOtherNewsList } from '@/api/api'

Vue.use(Vuex)
export const state = () => ({
  kfwxcode: {
    kfcode: '123',
    wxcode: '',
  },
  myData: null
})
export const mutations = {
  setImagePath (state, payload) {
    state.imagePaths[payload.key] = payload.path
  },
  setMyData (state, data) {
    state.myData = data
  }
}

export const actions = {
  async nuxtServerInit ({ commit }, { req, app }) {
    try {
      // 发送请求获取数据
      // let frontierdata = {
      //   "pageNum": 1,
      //   "pageSize": 6,
      //   "classify": "2",
      //   "state": "1",
      //   "flag": false
      // }
      // let res = await this.$axios.post(selectOtherNewsList, frontierdata)
      // let data = res.rows
      // // 将数据存储在 Vuex store 中
      // commit('setMyData', data)
    } catch (error) {
      console.error('Error fetching data:', error)
    }
  },
}
